'use strict';

/* eslint-disable fecs-no-require */
const loaderUtils = require('loader-utils');
/* eslint-enable */

module.exports = function (content) {
    if (this.cacheable) {
        this.cacheable();
    }

    const query = loaderUtils.getOptions(this);
    const alias = query.alias || {};

    Object.keys(alias).forEach(key => {
        content = content.replace(new RegExp(key, 'gi'), alias[key]);
    });

    return content;
};
